package com.hfh.Thread;

public class InterruptDemo2 extends Thread {
    @Override
    public void run() {
        while (!isInterrupted()) {
            System.out.println("run...");
        }
    }

    public static void main(String[] args) {
        InterruptDemo2 t = new InterruptDemo2();
        t.start();

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        t.interrupt();

    }
}
